<?php

namespace app\mini\model;

use app\admin\model\Common;
use app\mini\model\MiniPrizeModel;
use think\facade\Db;
class MiniPrizeLog extends Common
{

    protected $name = 'mini_prize_log';

    protected $createTime = 'created_at';

    protected $updateTime = 'updated_at';

    protected $autoWriteTimestamp = true;

    static public function prizeLog($customer_id,$prize_id,$event_id)
    {
        if($prize_id != 0)
        {
            $prize = MiniPrizeModel::find($prize_id);
            if(empty($prize)||$prize->status == 0)
            {
                return false;
            }
        }
        $prizeLog = new MiniPrizeLog();
        $prizeLog->prize_id = $prize_id;
        $prizeLog->customer_id = $customer_id;
        $prizeLog->event_id = $event_id;
        $res = $prizeLog->save();
        if(!$res)
        {
            return  false;
        }
        return true;
    }
}
